class Singleton3{
    private static volatile Singleton3 instance = null;
    private Singleton3(){

    }
    public static Singleton3 getInstance() {
        if(instance == null) {
            synchronized (Singleton3.class) {
                if (instance == null) {
                    instance = new Singleton3();
                }
            }
        }
        return instance;
    }
}
public class Test1 {
    public static void main(String[] args) {
        Singleton3 singleton3 = Singleton3.getInstance();
    }
}
